﻿using System;
using System.Collections.Generic;
using UnityEngine;

namespace DashFire
{
  class Uitils
  {
    public static void SetChild(GameObject child, GameObject parent, bool selfRotation = false, bool selfScale = false)
    {
      SetChild(child.transform, parent.transform, selfRotation, selfScale);
    }

    public static void SetChild(Transform child, Transform parent, bool selfRotation = false, bool selfScale = false)
    {
      child.parent = parent;
      ResetTransform(child, selfRotation, selfScale);
    }

    public static void ResetTransform(UnityEngine.Transform transform, bool selfRotation = false, bool selfScale = false)
    {
      transform.localPosition = UnityEngine.Vector3.zero;
      if (!selfRotation)
        transform.localEulerAngles = UnityEngine.Vector3.zero;

      if (!selfScale)
        transform.localScale = UnityEngine.Vector3.one;
    }
  }
}
